package com.threeox.commonlibrary.ui.view.impl;

import android.content.Context;
import android.view.ViewGroup;

import com.threeox.commonlibrary.entity.engine.model.multipage.DynamicPageDataMessage;
import com.threeox.commonlibrary.entity.engine.model.multipage.MultiPageMessage;
import com.threeox.commonlibrary.entity.engine.request.base.BaseRequestMsg;
import com.threeox.commonlibrary.ui.view.engineview.multipagemodel.MultiPageModelView;
import com.threeox.commonlibrary.ui.view.impl.base.CommonModelExtend;
import com.threeox.commonlibrary.ui.view.inter.IPageDataView;
import com.threeox.commonlibrary.ui.view.inter.engine.multipage.IMultiPageExtend;
import com.threeox.commonlibrary.ui.view.inter.engine.multipage.INavigationIndicator;

import java.util.List;

/**
 * 
 * @ClassName: AbstractMultiPageExtend
 * 
 * @Description: TODO(抽象的多页面扩展类)
 * 
 * @author 赵屈犇
 * 
 * @date 创建时间: 2017/8/10 14:23
 * 
 * @version 1.0
 * 
 */
public abstract class AbstractMultiPageExtend<T> extends CommonModelExtend implements IMultiPageExtend<T> {

    protected Context mContext;
    protected ViewGroup mContentViewGroup;
    protected MultiPageMessage mMultiPageMessage;
    protected MultiPageModelView mMultiPageModelView;
    protected INavigationIndicator mNavigationIndicator;

    @Override
    public void init(Context context, MultiPageModelView multiPageModelView) {
        this.mContext = context;
        this.mMultiPageModelView = multiPageModelView;
        this.mMultiPageMessage = mMultiPageModelView.getMultiPageMessage();
        this.mContentViewGroup = mMultiPageModelView.getContentViewGroup();
        this.mNavigationIndicator = mMultiPageModelView.getNavigationIndicator();
        initBaseExtend(mMultiPageModelView);
        initView();
        initData();
        setListener();
    }

    @Override
    public Integer onBeforeSetLayout(Integer layoutId, T data, DynamicPageDataMessage pageDataView) {
        return null;
    }

    @Override
    public void onAfterSetLayout(Integer layoutId, T data, IPageDataView pageDataView, int position) {

    }

    @Override
    public void switchoverFragment(int position) {

    }

    /*================ViewPager的滑动事件====================*/

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

    }

    @Override
    public void onPageSelected(int position) {

    }

    @Override
    public void onPageScrollStateChanged(int state) {

    }

    /*================ViewPager的滑动事件====================*/


    @Override
    public boolean onBeforeRequestSuccess(BaseRequestMsg requestMsg, String url, int id, String msg, List<T> data) {
        return true;
    }

    @Override
    public void onAfterRequestSuccess(BaseRequestMsg requestMsg, String url, int id, String msg, List<T> data) {

    }
}
